package com.xudow.app.dynamicstate_old.module.follow.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.squareup.picasso.Picasso;
import com.xudow.app.R;
import com.xudow.app.dynamicstate_old.JTimeTransform;
import com.xudow.app.dynamicstate_old.data.ImageModel;
import com.xudow.app.dynamicstate_old.domain.entity.DynamicFoward;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by zhuchenxi on 16/6/23.
 */

public class DynamicFowardViewHolder extends BaseViewHolder<DynamicFoward> {
    @BindView(R.id.img_avatar)
    CircleImageView imgAvatar;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_time)
    TextView tvTime;

    public DynamicFowardViewHolder(ViewGroup parent) {
        super(parent, R.layout.item_dynamic_foward);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(DynamicFoward data) {
        super.setData(data);
        Picasso.with(getContext()).load(ImageModel.getXueDouImage(data.getHeadUrl())).into(imgAvatar);
        tvName.setText(data.getUserName());
        tvTime.setText(new JTimeTransform(data.getForwardTime()).toString(new JTimeTransform.RecentDateFormat("MM-dd hh:mm")));
    }
}
